/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
    StyleSheet,
    Text,
    View,
    FlatList,
} from 'react-native';
import { Button } from "@ant-design/react-native";
import * as MediaLibrary from 'expo-media-library';
import {
    Asset,
    Constants,
    FileSystem,
    Permissions,
} from 'react-native-unimodules';


type Props = {};
export default class Unimodules extends Component<Props> {

    constructor(props) {
        super(props);

        this.state = {
            visible: false
        }
    }

    componentDidMount() {

    }

    render() {
        return (
            <View style={styles.container}>

                <Button
                    onPress={() => {
                        this.constants();
                    }}
                >相册</Button>
            </View>
        );
    }
    async getCameraRollPermissions() {
        const { status } = await Permissions.askAsync(Permissions.CAMERA_ROLL);
        if (status === 'granted') {
        } else {
            /// Handle permissions denied;
            console.log('Uh oh! The user has not granted us permission.');
        }
    }
    constants = ()=>{
        console.warn(Constants.deviceName, FileSystem.documentDirectory);
        
    }
    createMediaLibrary = async ()=>{
       let {assets, endCursor,hasNextPage, totalCount} = await MediaLibrary.getAssetsAsync({first:4});
       console.warn(assets);
       

    }

}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF',
    }
});

